package com.sxbbc.common.core.mapper.jz;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sxbbc.common.core.entity.jz.ChickenCoupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sxbbc.common.core.utils.BasePage;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 提鸡券信息 Mapper 接口
 * </p>
 *
 * @author
 * @since 2020-03-27
 */
public interface ChickenCouponMapper extends BaseMapper<ChickenCoupon> {
    /***
     * 查询提鸡券列表信息
     * @param page
     * @param chickenCoupon
     */
    IPage<ChickenCoupon> selectChickenCouponList(BasePage<ChickenCoupon> page, @Param("param") ChickenCoupon chickenCoupon);

    int countOrderNum(ChickenCoupon chickenCoupon);

    /**
     * 释放提鸡券 定时任务执行
     *
     * @return
     */
    int releaseCoupon();

    /**
     * 处理已预约但过了预约日期没核销的 提鸡券
     *
     * @param chickenCoupon
     * @param ccidsList
     * @return
     */
    int handleSubscribeInvalidCoupon(@Param("param") ChickenCoupon chickenCoupon, @Param("list") ArrayList<Integer> ccidsList);

    /**
     * 过了提鸡有效期
     *
     * @return
     */
    int handleInvalidCoupon(@Param("param") ChickenCoupon chickenCoupon);

    int setTime();

    String getMaxNumber(@Param("cid") Integer cid);


    List<ChickenCoupon> selectReleaseCoupon();
}
